(0) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, n^2).


The TRS R consists of the following rules:

append(@l1, @l2) → append#1(@l1, @l2)
append#1(::(@x, @xs), @l2) → ::(@x, append(@xs, @l2))
append#1(nil, @l2) → @l2
subtrees(@t) → subtrees#1(@t)
subtrees#1(leaf) → nil
subtrees#1(node(@x, @t1, @t2)) → subtrees#2(subtrees(@t1), @t1, @t2, @x)
subtrees#2(@l1, @t1, @t2, @x) → subtrees#3(subtrees(@t2), @l1, @t1, @t2, @x)
subtrees#3(@l2, @l1, @t1, @t2, @x) → ::(node(@x, @t1, @t2), append(@l1, @l2))

Rewrite Strategy: INNERMOST

(1) CpxTrsToCdtProof (BOTH BOUNDS(ID, ID) transformation)

Converted Cpx (relative) TRS to CDT

(2) Obligation:

Complexity Dependency Tuples Problem
Rules:

append(z0, z1) → append#1(z0, z1)
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
subtrees(z0) → subtrees#1(z0)
subtrees#1(leaf) → nil
subtrees#1(node(z0, z1, z2)) → subtrees#2(subtrees(z1), z1, z2, z0)
subtrees#2(z0, z1, z2, z3) → subtrees#3(subtrees(z2), z0, z1, z2, z3)
subtrees#3(z0, z1, z2, z3, z4) → ::(node(z4, z2, z3), append(z1, z0))
Tuples:

APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
APPEND#1(nil, z0) → c2
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#1(leaf) → c4
SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
S tuples:

APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
APPEND#1(nil, z0) → c2
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#1(leaf) → c4
SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
K tuples:none
Defined Rule Symbols:

append, append#1, subtrees, subtrees#1, subtrees#2, subtrees#3

Defined Pair Symbols:

APPEND, APPEND#1, SUBTREES, SUBTREES#1, SUBTREES#2, SUBTREES#3

Compound Symbols:

c, c1, c2, c3, c4, c5, c6, c7

(3) CdtLeafRemovalProof (BOTH BOUNDS(ID, ID) transformation)

Removed 2 trailing nodes:

SUBTREES#1(leaf) → c4
APPEND#1(nil, z0) → c2

(4) Obligation:

Complexity Dependency Tuples Problem
Rules:

append(z0, z1) → append#1(z0, z1)
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
subtrees(z0) → subtrees#1(z0)
subtrees#1(leaf) → nil
subtrees#1(node(z0, z1, z2)) → subtrees#2(subtrees(z1), z1, z2, z0)
subtrees#2(z0, z1, z2, z3) → subtrees#3(subtrees(z2), z0, z1, z2, z3)
subtrees#3(z0, z1, z2, z3, z4) → ::(node(z4, z2, z3), append(z1, z0))
Tuples:

APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
S tuples:

APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
K tuples:none
Defined Rule Symbols:

append, append#1, subtrees, subtrees#1, subtrees#2, subtrees#3

Defined Pair Symbols:

APPEND, APPEND#1, SUBTREES, SUBTREES#1, SUBTREES#2, SUBTREES#3

Compound Symbols:

c, c1, c3, c5, c6, c7

(5) CdtRuleRemovalProof (UPPER BOUND(ADD(n^1)) transformation)

Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.

SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
We considered the (Usable) Rules:none
And the Tuples:

APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(::(x1, x2)) = [2]   
POL(APPEND(x1, x2)) = 0   
POL(APPEND#1(x1, x2)) = 0   
POL(SUBTREES(x1)) = x1   
POL(SUBTREES#1(x1)) = x1   
POL(SUBTREES#2(x1, x2, x3, x4)) = x3   
POL(SUBTREES#3(x1, x2, x3, x4, x5)) = 0   
POL(append(x1, x2)) = [1] + [3]x1 + [2]x2   
POL(append#1(x1, x2)) = [2]x1 + x2   
POL(c(x1)) = x1   
POL(c1(x1)) = x1   
POL(c3(x1)) = x1   
POL(c5(x1, x2)) = x1 + x2   
POL(c6(x1, x2)) = x1 + x2   
POL(c7(x1)) = x1   
POL(leaf) = 0   
POL(nil) = 0   
POL(node(x1, x2, x3)) = [2] + x2 + x3   
POL(subtrees(x1)) = 0   
POL(subtrees#1(x1)) = 0   
POL(subtrees#2(x1, x2, x3, x4)) = 0   
POL(subtrees#3(x1, x2, x3, x4, x5)) = 0   

(6) Obligation:

Complexity Dependency Tuples Problem
Rules:

append(z0, z1) → append#1(z0, z1)
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
subtrees(z0) → subtrees#1(z0)
subtrees#1(leaf) → nil
subtrees#1(node(z0, z1, z2)) → subtrees#2(subtrees(z1), z1, z2, z0)
subtrees#2(z0, z1, z2, z3) → subtrees#3(subtrees(z2), z0, z1, z2, z3)
subtrees#3(z0, z1, z2, z3, z4) → ::(node(z4, z2, z3), append(z1, z0))
Tuples:

APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
S tuples:

APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
K tuples:

SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
Defined Rule Symbols:

append, append#1, subtrees, subtrees#1, subtrees#2, subtrees#3

Defined Pair Symbols:

APPEND, APPEND#1, SUBTREES, SUBTREES#1, SUBTREES#2, SUBTREES#3

Compound Symbols:

c, c1, c3, c5, c6, c7

(7) CdtKnowledgeProof (BOTH BOUNDS(ID, ID) transformation)

The following tuples could be moved from S to K by knowledge propagation:

SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))

(8) Obligation:

Complexity Dependency Tuples Problem
Rules:

append(z0, z1) → append#1(z0, z1)
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
subtrees(z0) → subtrees#1(z0)
subtrees#1(leaf) → nil
subtrees#1(node(z0, z1, z2)) → subtrees#2(subtrees(z1), z1, z2, z0)
subtrees#2(z0, z1, z2, z3) → subtrees#3(subtrees(z2), z0, z1, z2, z3)
subtrees#3(z0, z1, z2, z3, z4) → ::(node(z4, z2, z3), append(z1, z0))
Tuples:

APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
S tuples:

APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
K tuples:

SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
SUBTREES(z0) → c3(SUBTREES#1(z0))
Defined Rule Symbols:

append, append#1, subtrees, subtrees#1, subtrees#2, subtrees#3

Defined Pair Symbols:

APPEND, APPEND#1, SUBTREES, SUBTREES#1, SUBTREES#2, SUBTREES#3

Compound Symbols:

c, c1, c3, c5, c6, c7

(9) CdtRuleRemovalProof (UPPER BOUND(ADD(n^2)) transformation)

Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.

APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
We considered the (Usable) Rules:

subtrees#3(z0, z1, z2, z3, z4) → ::(node(z4, z2, z3), append(z1, z0))
subtrees#2(z0, z1, z2, z3) → subtrees#3(subtrees(z2), z0, z1, z2, z3)
append(z0, z1) → append#1(z0, z1)
append#1(nil, z0) → z0
subtrees(z0) → subtrees#1(z0)
subtrees#1(node(z0, z1, z2)) → subtrees#2(subtrees(z1), z1, z2, z0)
subtrees#1(leaf) → nil
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
And the Tuples:

APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(::(x1, x2)) = [2] + x2   
POL(APPEND(x1, x2)) = [1] + x1   
POL(APPEND#1(x1, x2)) = x1   
POL(SUBTREES(x1)) = x12   
POL(SUBTREES#1(x1)) = x12   
POL(SUBTREES#2(x1, x2, x3, x4)) = [1] + x1 + [2]x3 + x32   
POL(SUBTREES#3(x1, x2, x3, x4, x5)) = [1] + x2 + [2]x4   
POL(append(x1, x2)) = x1 + x2   
POL(append#1(x1, x2)) = x1 + x2   
POL(c(x1)) = x1   
POL(c1(x1)) = x1   
POL(c3(x1)) = x1   
POL(c5(x1, x2)) = x1 + x2   
POL(c6(x1, x2)) = x1 + x2   
POL(c7(x1)) = x1   
POL(leaf) = 0   
POL(nil) = 0   
POL(node(x1, x2, x3)) = [1] + x2 + x3   
POL(subtrees(x1)) = [2]x1   
POL(subtrees#1(x1)) = [2]x1   
POL(subtrees#2(x1, x2, x3, x4)) = [2] + x1 + [2]x3   
POL(subtrees#3(x1, x2, x3, x4, x5)) = [2] + x1 + x2   

(10) Obligation:

Complexity Dependency Tuples Problem
Rules:

append(z0, z1) → append#1(z0, z1)
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
subtrees(z0) → subtrees#1(z0)
subtrees#1(leaf) → nil
subtrees#1(node(z0, z1, z2)) → subtrees#2(subtrees(z1), z1, z2, z0)
subtrees#2(z0, z1, z2, z3) → subtrees#3(subtrees(z2), z0, z1, z2, z3)
subtrees#3(z0, z1, z2, z3, z4) → ::(node(z4, z2, z3), append(z1, z0))
Tuples:

APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
S tuples:none
K tuples:

SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
SUBTREES(z0) → c3(SUBTREES#1(z0))
APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
Defined Rule Symbols:

append, append#1, subtrees, subtrees#1, subtrees#2, subtrees#3

Defined Pair Symbols:

APPEND, APPEND#1, SUBTREES, SUBTREES#1, SUBTREES#2, SUBTREES#3

Compound Symbols:

c, c1, c3, c5, c6, c7

(11) SIsEmptyProof (BOTH BOUNDS(ID, ID) transformation)

The set S is empty

(12) BOUNDS(1, 1)